package com.freeter.modules.gjs.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

/**
 * 文件监控服务配置类
 * 
 * @author freeter
 * @since 2024-01-01
 */
@Configuration
@ConfigurationProperties(prefix = "filewatcher")
public class FileWatcherConfig {
    
    /**
     * 计算票据文件夹路径
     */
    private String calcTicketFolder = "./calc_tickets";
    
    /**
     * 站点URL
     */
    private String siteUrl = "http://localhost:8080";
    
    /**
     * 监控间隔（毫秒）
     */
    private long watchInterval = 1000;
    
    /**
     * 最大重试次数
     */
    private int maxRetries = 3;
    
    /**
     * 重试间隔（毫秒）
     */
    private long retryInterval = 1000;
    
    /**
     * 邮件配置
     */
    private EmailConfig email = new EmailConfig();
    
    /**
     * 目录配置
     */
    private Map<String, String> directories;
    
    public static class EmailConfig {
        private boolean enabled = true;
        private String smtpHost = "localhost";
        private int smtpPort = 587;
        private String smtpUsername;
        private String smtpPassword;
        private String fromEmail = "noreply@example.com";
        
        // Getters and Setters
        public boolean isEnabled() { return enabled; }
        public void setEnabled(boolean enabled) { this.enabled = enabled; }
        
        public String getSmtpHost() { return smtpHost; }
        public void setSmtpHost(String smtpHost) { this.smtpHost = smtpHost; }
        
        public int getSmtpPort() { return smtpPort; }
        public void setSmtpPort(int smtpPort) { this.smtpPort = smtpPort; }
        
        public String getSmtpUsername() { return smtpUsername; }
        public void setSmtpUsername(String smtpUsername) { this.smtpUsername = smtpUsername; }
        
        public String getSmtpPassword() { return smtpPassword; }
        public void setSmtpPassword(String smtpPassword) { this.smtpPassword = smtpPassword; }
        
        public String getFromEmail() { return fromEmail; }
        public void setFromEmail(String fromEmail) { this.fromEmail = fromEmail; }
    }
    
    // Getters and Setters
    public String getCalcTicketFolder() { return calcTicketFolder; }
    public void setCalcTicketFolder(String calcTicketFolder) { this.calcTicketFolder = calcTicketFolder; }
    
    public String getSiteUrl() { return siteUrl; }
    public void setSiteUrl(String siteUrl) { this.siteUrl = siteUrl; }
    
    public long getWatchInterval() { return watchInterval; }
    public void setWatchInterval(long watchInterval) { this.watchInterval = watchInterval; }
    
    public int getMaxRetries() { return maxRetries; }
    public void setMaxRetries(int maxRetries) { this.maxRetries = maxRetries; }
    
    public long getRetryInterval() { return retryInterval; }
    public void setRetryInterval(long retryInterval) { this.retryInterval = retryInterval; }
    
    public EmailConfig getEmail() { return email; }
    public void setEmail(EmailConfig email) { this.email = email; }
    
    public Map<String, String> getDirectories() { return directories; }
    public void setDirectories(Map<String, String> directories) { this.directories = directories; }
} 